<template>
  <!-- 登录 -->
  <el-form
    ref="forgotPasswordForm"
    label-width="100px"
    class="container"
  >
    <el-form-item label="邮箱">
      <el-input
        v-model="email"
        type="email"
        placeholder="Enter Email ...."
      ></el-input>
    </el-form-item>
    <el-form-item>
      <el-button
        type="primary"
        class="submit-btn"
        @click="handleForgetPassword()"
        >找回密码</el-button
      >
    </el-form-item>
    
  </el-form>
</template>

<script lang="ts">
import { defineComponent, getCurrentInstance, ref } from "vue";
import {useRouter} from 'vue-router'

export default defineComponent({
  setup() {
    const { ctx } = getCurrentInstance() as any;
    const router = useRouter()
    const email = ref<string>('')
    const handleForgetPassword:() => void = async () => {
      // email.value
      const res = await ctx.$refs['forgotPasswordForm'].$axios.post('/api/v1/auth/forgotpassword', {email: email.value}).then((res:any) => {
      })
      console.log(res.data)

    }
   

    return { handleForgetPassword, email };
  },
});
</script>

<style scoped>
  .container {
    width: 50%;
    margin: 200px auto;
  }
.submit-btn {
  width: 100%;
}
</style>